labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
## second data set
survey <- read.dta13("harris_s2624_nonvoter_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- NA
# inequality variable (inequality.variable)
survey$inequality.variable <- NA
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1B
# gender
survey$gender <- survey$F8
# religion
survey$religion <- survey$F5A
# subset
survey_2624SLnonvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
survey_2624 <- cbind(survey_2624SLnonvoters, survey_2624SLvoters)
survey_2624 <- rbind(survey_2624SLnonvoters, survey_2624SLvoters)
rownames(survey_2624)
colnames(survey_2624)
summary(survey_2624$inequality)
table(survey_2624$inequality)
survey <- read.dta13("harris_s2624_voters_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
class(survey$urban)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
survey$hh <- NA
survey$inequality <- car::recode(survey$Q6_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
class(survey$inequality)
survey <- read.dta13("harris_s2624_voters_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
class(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q6_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
class(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
## second data set
survey <- read.dta13("harris_s2624_nonvoter_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- NA
# inequality variable (inequality.variable)
survey$inequality.variable <- NA
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1B
# gender
survey$gender <- survey$F8
# religion
survey$religion <- survey$F5A
# subset
survey_2624SLnonvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
survey_2624 <- rbind(survey_2624SLnonvoters, survey_2624SLvoters)
summary(survey_2624)
table(survey_2624$inequality)
survey_2624$inequality <- factor(survey_2624$inequality)
table(survey_2624$inequality)
summary(survey_2624$inequality)
survey_2624$inequality <- recode(survey_2624$inequality,
`Don t feel` = "Don't Feel",
`Not sure` = "Not Sure")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624S-L")
library(dplyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2624_voters_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13,
"'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
class(survey$urban)
summary(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q6_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
class(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
## second data set
survey <- read.dta13("harris_s2624_nonvoter_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- NA
# inequality variable (inequality.variable)
survey$inequality.variable <- NA
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1B
# gender
survey$gender <- survey$F8
# religion
survey$religion <- survey$F5A
# subset
survey_2624SLnonvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
survey_2624SL <- rbind(survey_2624SLnonvoters, survey_2624SLvoters)
summary(survey_2624SL)
survey_2624SL$inequality <- factor(survey_2624SL$inequality)
summary(survey_2624SL$inequality)
survey_2624SL$inequality <- dplyr::recode(survey_2624SL$inequality,
`Don t feel` = "Don't Feel",
`Not sure` = "Not Sure")
summary(survey_2624SL$inequality)
survey_2624SL$pid <- c(1:nrow(survey_2624SL))
summary(survey_2624SL)
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624S-L")
library(dplyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2624_voters_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13,
"'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
class(survey$urban)
summary(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q6_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
class(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- survey$F3_1 # already harmonized
# union (union.other) question
survey$union.other <- survey$F3_2 # already harmonized
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
saveRDS(survey_2624SLvoters, file = "survey_2624SLvoters.rds")
setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 ABC Presidential Election Survey, study no. 2624S-L")
library(dplyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s2624_voters_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 2624
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13,
"'Central city' = 'Urban'; 'Town' = 'Rural'; 'Suburb' = 'Suburban'")
class(survey$urban)
summary(survey$urban)
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- NA
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$Q6_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
class(survey$inequality)
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.character(survey$F3_1)
survey$union.self[survey$F3_4 == "Yes"] <- "Not Sure"
survey$union.self <- factor(survey$union.self)
survey$union.other <- as.character(survey$F3_2)
survey$union.other[survey$F3_4 == "Yes"] <- "Not Sure"
survey$union.other <- factor(survey$union.other)
# employment (employed)
survey$employed <- survey$F1A
# occupation
survey$occupation <- survey$F1B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- car::recode(survey$F2, "c('No formal schooling (0 years)', 'Frst thrgh 7th grd (1-7 yrs cmpltd)', '8th grade (8 years of school completed)', 'Sm hgh schl (9-11 yrs f schl cmpltd)') = 'Less than high school';
'Hgh schl grdt (12 yrs f schl cmpltd)' = 'High school graduate';
c('Tw yr cllg grdt (cmpltd 2 yrs cmmnty cll', 'Sm cllg (1-3 yrs f cllg cmpltd)') = 'Some college';
'Fr yr cllg grdt (cmpltd 4 yrs f cllg)' = 'College graduate';
'Post graduate (4 year college graduate a' = 'Post graduate'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F4
# age
survey$age <- survey$S4
# race
survey$race <- survey$F7
# politics (party)
survey$party <- survey$S3
# politics (ideology)
survey$ideology <- survey$Q1D
# gender
survey$gender <- survey$F8
# religion
survey$religion <- NA # could not find variable listed in spreadsheet, F5A/B
# subset
survey_2624SLvoters <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_2624SLvoters)
saveRDS(survey_2624SLvoters, file = "survey_2624SLvoters.rds")
